<?php defined('SEJUJOPEFDNGJSL') or exit('Access denied'); ?>
<div class="panel panel-inverse">
    <div class="panel-heading">
        <h4 class="panel-title">转币会员</h4>
    </div>
    <div class="panel-body">
        <form action="" method="post" name="theform" class="form-horizontal">
            <script type="text/javascript">
            </script>
            <fieldset style="border: none;">
                $sql = 'SELECT id,username,hash,qb_address,in_number,FROM_UNIXTIME(addtime) FROM ld_myzr';
                require_once "./ethereum/dbc.php";
                $db = new Dbc($GLOBALARR['dbhost'], $GLOBALARR['dbuser'], $GLOBALARR['dbpwd'], 'utf8',$GLOBALARR['dbname']);
                $arr['ttr']  = $db->select_all($sql);
                $arr['tcount'] = $len = count($arr['ttr'] );

                $str_str = '';
                while ($len >= 0) {
                    $len--;
                    $str_str .= '<tr>';
                    foreach ($arr['ttr'][$len - 1] as $k => $v) {
                        $str_str .= '<td>' . $v . '</td>';
                    }
                    $str_str .= '</tr>';
                }
                $arr['tth'] = "<th>序号</th><th>用户名</th><th>哈希</th><th>转出地址</th><th>转出数量</th><th>转出时间</th>";
                echo '	</form><form method="post" action="' . geturl() . '">';
                echo '<table class="thealist ttab">
		<tr>
' . $arr['tth'] . '
		</tr>
		<tbody>';
                if ($arr['tcount'] > 0) {
                    echo $str_str;
                    //$db->query('select * from yang_myzc');
                }
                echo '	</tbody>
	</table></form>';
                if ($arr['tcount'] == 0) {
                    echo '<div class="nodata">暂无数据</div>';
                }
                    <div class="form-group xfje">
                        <label class="col-md-3 control-label ui-sortable">用户名</label>
                        <div class="col-md-9 ui-sortable">
                            <input type="text" name="fromUname" id="fromUname" value="" class="form-control" />
                        </div>
                    </div>
                    <div class="form-group xfje">
                        <label class="col-md-3 control-label ui-sortable">Vic数量</label>
                        <div class="col-md-9 ui-sortable">
                            <input type="text" name="num" id="num" value="" class="form-control" />
                        </div>
                    </div>

                </div>
                <div class="form-group">
                    <div class="col-md-9 col-md-offset-3 ui-sortable">
                        <input type="button" onclick="check()" class="btn btn-md btn-primary" value="确定">
                    </div>
                </div>
            </fieldset>
        </form>

    </div>
</div>

<div class="panel panel-inverse">
    <div class="panel-heading">
        <div class="row">
            <div class="col-md-12">
                <h4 class="panel-title" style="float: left;">转出记录</h4>
                <!-- <a href="home.php?lsact=zhuanhuan" style="color:#fff;float: right;">返回</a> -->
            </div>
        </div>
    </div>
    <div class="panel-body">
        <div class="table-responsive">
            <table class="table table-striped givetable">
                <tbody>
                <tr>
                    <th>序号</th>
                    <th>转出用户</th>
                    <th>转出数量</th>
                    <th>转出时间</th>
                </tr>
                <?php
                $records=toUserCoin_list($_userid);
                // var_dump($records);exit;
                $ii=0;
                foreach ($records['arr'] as $k => $v) {
                    $ii++;
                    ?>
                    <tr>
                        <td align="center"><?php echo $ii;?></td>
                        <td align="center"><?php echo $v['touser'];?></td>
                        <td align="center"><?php echo $v['coinnum'];?></td>
                        <td align="center"><?php echo formatdate($v['inserttime'])?></td>
                    </tr>
                    <?php
                }
                ?>
                </tbody>
            </table>
        </div>
    </div>
</div>
<!--<script type="text/javascript" src="theme/js/layer/layer.js"></script>-->


<script>
    function check(){

        var fromUname=$('#fromUname').val();
        var num=$('#num').val();


        var index = layer.load(0, {shade: [0.5,'#8F8F8F']});
        var ajaxTimeoutTest =$.ajax({
            type: "get",
            dataType: "json",
            timeout : 13000,
            url: "/ajax.php?act=userCashCoin&toUname="+fromUname+"&num="+num,
            success: function(data){
                if(data.status==0){
                    layer.alert(data.tips, function(index){
                        layer.closeAll();
                    });

                }else{
                    layer.alert(data.tips, function(index){
                        window.location.href="home.php?lsact=index";
                    });

                }

            },
            error: function(){

            },
            complete : function(XMLHttpRequest,status){ //请求完成后最终执行参数
                if(status=='timeout'){//超时,status还有success,error等值的情况
                    ajaxTimeoutTest.abort();
                    layer.alert('现在人多请稍后重试，不要刷新页面，请重新提交！', function(index){
                        layer.closeAll();
                    });

                }
            }
        });
    }

</script>
